<?php
/*
 * @Author: your name
 * @Date: 2021-11-02 20:43:06
 * @LastEditTime: 2022-01-10 10:48:19
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \property\app\Http\Controllers\admin_controller\BaseController.php
 */

namespace App\Http\Controllers\find_shop;

use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Request;

use App\Http\Controllers\redis\RedisController as Redis;

class BaseController extends Controller
{
    
    /**
     * @description: 返回参数
     * @param int    $code       状态码
     * @param string $msg        返回信息
     * @param array  $data       参数
     * @param int    $trueCode   真状态码
     * @return 
     */    
    protected function create($code,$msg='',$data=[],$trueCode = 200){
          $result = [
              'code'=>$code,
              'message'=>$msg,
              'data'=>$data
          ];
          if(isset($_POST['HTTP_SERVER'])){
            $_POST['HTTP_SERVER']->status($trueCode);
              return response( $result);
          }else{
             
              return response( $result,$trueCode );
          }
    }


    protected function getLoginMsg(){
        $token = $_SERVER['TOKEN'];
        $key = SHOP_LOGIN_REDIS_KEY.$token;
        $openid =  Redis::hGET($key,'openid' ,['RedisDB' => 12]);
        return $openid;
    }
}
